package com.ccrfid.rmc6.repository.sys;

import com.ccrfid.rmc6.entity.sys.OrgEntity;
import org.springframework.data.repository.Repository;

import java.util.List;

public interface OrgRepository extends Repository<OrgEntity, Long> {
    //
    List<OrgEntity> getAllByOrgType(Integer orgType);
    //
    List<OrgEntity> getAllBy();
    //
    List<OrgEntity> getAllByPid(Long pid);
    //
    List<OrgEntity> getAllByPidAndEnabled(Long pid, Integer enabled);
    //
    OrgEntity getById(Long id);
    //
    OrgEntity getByOrgSn(String orgSn);
    //
    Boolean existsById(Long id);
    Boolean existsByPid(Long pid);
    Boolean existsByOrgSn(String orgSn);
    Boolean existsByOrgSnAndIdNot(String orgSn, Long id);
    //
    OrgEntity save(OrgEntity entity);
    //
    void deleteById(Long id);
    //
    OrgEntity getTopByOrgTypeAndPidIsNull(Integer orgType);
    //
    List<OrgEntity> getAllByEnabledAndOrgNameContainingOrderBySortNumber(Integer enabled, String orgName);
    List<OrgEntity> getAllByEnabledAndOrgNameEndingWithOrderBySortNumber(Integer enabled, String orgName);
    List<OrgEntity> getAllByEnabledAndOrgTypeAndOrgNameEndingWithOrderBySortNumber(Integer enabled, Integer orgType, String orgName);
    //
    List<OrgEntity> getAllByEnabledAndOrgNameContainingAndIdInOrderBySortNumber(Integer enabled, String orgName, List<Long> idList);
    List<OrgEntity> getAllByEnabledAndOrgNameEndingWithAndIdInOrderBySortNumber(Integer enabled, String orgName, List<Long> idList);

    List<OrgEntity> getAllByEnabledAndRemarkContainingOrderBySortNumber(int i, String remark);

    List<OrgEntity> getAllByEnabledAndRemarkContainingAndIdInOrderBySortNumber(int i, String remark, List<Long> idList);

    List<OrgEntity> getAllByEnabledAndOrgTypeAndRemarkContainingOrderBySortNumber(int i, Integer id, String remark);

    List<OrgEntity> getAllByIdInAndEnabledAndOrgNameContainingOrderBySortNumber(List<Long> orgIdList, int i, String orgName);

}
